package com.hejielife.singlethreadedexecution3;

/**
 * 2019年8月2日 上午10:23:14
 * 
 * @author hejielife
 * @despribe 解决死锁的方法：获取资源的顺序一致
 */
public class Main1 {
	public static void main(String[] args) {
		System.out.println("Testing EaterThread, hit CTRL+C to exit.");
		Tool spoon = new Tool("Spoon");
		Tool fork = new Tool("Fork");
		// 试试放开注释，顺序不一致，死锁是否发生
		// new EaterThread("Alice", fork, spoon).start();
		new EaterThread1("Alice", spoon, fork).start();
		new EaterThread1("Bobby", spoon, fork).start();
	}
}
